package com.shop.controller;

import com.shop.pojo.Account;
import com.shop.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/account")
public class AccountController {

    @Autowired
    AccountService accountService;

    @RequestMapping("/add")
    public String add(Model model){
        Account account = new Account();
        account.setMoney(1000);
        int i = accountService.addAccount(account);
        model.addAttribute("msg", i > 0 ? "成功！" : "失败！");
        return "res";
    }

}
